import { gooItemApi } from './api'
import axios from 'axios'

export default {
  addOne(gooItem) {
    return axios({
      method: 'post',
      url: gooItemApi.addOneUrl(),
      data: gooItem,
      withCredentials: true
    })
  },
  updateOne(gooId,gooItem) {
    return axios({
      method: 'put',
      url: gooItemApi.updateOneUrl(gooId),
      data: gooItem,
      withCredentials: true
    })
  },
  updateStatus(gooId,status) {
    return axios({
      method: 'put',
      url: gooItemApi.updateStatusUrl(gooId,status),
      withCredentials: true
    })
  },
  updateDesc(gooId,itemDesc) {
    return axios({
      method: 'put',
      url: gooItemApi.updateDescUrl(gooId),
      data:itemDesc,
      withCredentials: true
    })
  },
  getOne(gooId) {
    return axios({
      method: 'get',
      url: gooItemApi.getOneUrl(gooId),
      withCredentials: true
    })
  },
  getList(params) {
    return axios({
      method: 'get',
      url: gooItemApi.getListUrl(params),
      withCredentials: true
    })
  }, 
  deleteOne(gooId) {
    return axios({
      method: 'delete',
      url: gooItemApi.deleteOneUrl(gooId),
      withCredentials: true
    })
  },
}
